<?php

/**
 * Application level View Helper
 *
 * This file is application-wide helper file. You can put all
 * application-wide helper-related methods here.
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.View.Helper
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
App::uses('Helper', 'View');

/**
 * Application helper
 *
 * Add your application-wide methods in the class below, your helpers
 * will inherit them.
 *
 * @package       app.View.Helper
 */
class AppHelper extends Helper {

    /**
     * Function with update for multilanguage.
     * 
     * Finds URL for specified action.
     *
     * Returns a URL pointing at the provided parameters.
     *
     * @param string|array $url Either a relative string url like `/products/view/23` or
     *    an array of URL parameters. Using an array for URLs will allow you to leverage
     *    the reverse routing features of CakePHP.
     * @param bool $full If true, the full base URL will be prepended to the result
     * @return string Full translated URL with base path.
     * @link http://book.cakephp.org/2.0/en/views/helpers.html
     */
    public function url($url = null, $full = false) {
        if (is_array($url)) {
            if (!isset($url['language']) && isset($this->params['language'])) {
                $url['language'] = $this->params['language'];
            }
        }
        return parent::url($url, $full);
    }

}
